<script type="text/javascript">
$(function(){
	$.get("applicationSingle/getCardInfo",function(data){
		var content="<option value='' selected>请选择</option>";
		var i;
		$(data).each(function(n,item){
			for(i=0;i<item.certificates.length;i++){
				content+="<option value="+item.certificates[i].certificateType+">"
				+item.certificates[i].certificatesName+"</option>"
			}
			$("#paperTypeByCancelCard").html(content);
		});
	},"json");	
});

//读卡测试卡是否可读，可读则读出信息(余额，证件号，证件类型)
function testIsRead(){
	var flag=activeCPU()
	if(flag){
		flag=qzsmkocx.GetSmkNo();
	}
	var f;
	var text;
	if(flag){
		var citizenCardNo=qzsmkocx.GetRetValue().split(",")[0];
		$("input[name='citizenCardNo']").val(citizenCardNo);
		$.post("cancelCard/getAppAndEp",{citizenCardNo:citizenCardNo},function(json){
			if(json.statusCode==DWZ.statusCode.error){
				navTabAjaxDone(json)
				return
			}
			if(json.length==0){
				alertMsg.warn('此卡未开通任何应用,或者还未出售');
				$("input[name='isRead']").val("");
			}
				for(var i=0;i<json.length;i++){
					var adf=json[i].appFlag;
					for(var j=0;j<2;j++){
						var epEd
						if(j==0) epEd="01"
						if(j==1) epEd="02"
						var b=getBalance(adf,epEd);
						if(b){
							var r=qzsmkocx.GetRetValue().split(",")[0];
							if(r!="0.00"){
								text="1";
								alertMsg.warn('您的卡有余额无法注销！');
								$("input[name='isRead']").val(text);
								$("input[name='blance']").val(r);
								return false;
							}else{
								text="1";
								alertMsg.correct('您的卡无余额可以注销！');
								$("input[name='isRead']").val(text);
								$("input[name='blance']").val(r);
							}	
						}else{
							text="2";
							alertMsg.warn('您的卡余额不可读！');
							$("input[name='isRead']").val(text);
							return false;
					}
				}
			}
		},"json")
	}else{
		text="2";
		checkError(getError())	
		$("input[name='isRead']").val(text);
	}	
}

function checkByCancelCard(){
	var isRead=$("input[name='isRead']").val();
	var blance=$("input[name='blance']").val();
	if(isRead==""){
		alertMsg.warn('请先读卡')
		return false;
	}
	if(isRead=="2"){
		alertMsg.warn("您卡不可读无法注销")
		return false;
	}
	if(blance!="0.00"){
		alertMsg.warn("您卡有余额无法注销") 
		return false;
	}
}
</script>

<div class="pageHeader ">
	<form id="pagerForm" method="post"
		action="cancelCard/getCancelCardInfo"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this,getCancelCardInfo);">
		<input type="hidden" name="pageNum" value="" /> <input type="hidden"
			name="numPerPage" value="" />
		<!-- <input type="hidden" name="pageCount" value="" /> -->
		<div class="searchBar">
			<!-- <table class="searchContent">
			<tr>
				<td><label>测试卡是否可读：</label></td>
				<td style="text-align:left"><input  class="" type="button" size="30"  value="读卡" onclick="testIsRead()"/>
				<input name="isRead" type="hidden" value="" >
				<input name="blance" type="hidden" value="" ></td>
			
				<td><label>市民卡号：</label></td>
				<td><input  name="citizenCardNo"  class="digits" type="text" size="30"/></td>
			</tr>
			<tr>
				<td style="text-align:left"><label>证件类型：</label></td>
				<td style="text-align:left"><select id="paperTypeByCancelCard" name="paperType" class="">
			
				</select></td>
			
				<td><label>证件号码：</label></td>
				<td><input  name="paperNo"  class="" type="text" size="30"  /></td>
			</tr>
			</table> -->
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-6 col-sm-12">
					<p>
						<label>测试卡是否可读：</label><input class="newButton" type="button" style="width:12%"
							value="读卡" onclick="testIsRead()" /> <input name="isRead"
							type="hidden" value=""> <input name="blance"
							type="hidden" value="">
					</p>
				</div>
				<div class="col-md-6 col-sm-12">
					<p>
						<label>市民卡号：</label><input name="citizenCardNo" class="digits"
							type="text" size="26" readonly="readonly"/>
					</p>
				</div>
			</div>
			<!-- 20181208  hgl 修改以下14行 -->
			<!-- <div class="row" style="padding: 0 10px;">
				<div class="col-md-6 col-sm-12">
					<p>
						<label>证件类型：</label> <select id="paperTypeByCancelCard"
							name="paperType" class=""></select>
					</p>
				</div>
				<div class="col-md-6 col-sm-12">
					<p>
						<label>证件号码：</label><input name="paperNo" class="" type="text"
							size="26" />
					</p>
				</div>
			</div> -->
			<div class="subBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit" onclick="return checkByCancelCard()">查询</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</form>
</div>

<form method="post" action="cancelCard/goCancelRegister" class=""
	onsubmit="return validateCallback(this,navTabAjaxDone);">
	<input name="isRead" type="hidden" value="">
	<div class="pageContent">
		<div id="ByCancelCard">
			<table class="table" width="100%" layoutH="298">
				<thead>
					<tr align="center">
						<!-- <th width="2%"><input name="" onclick="checkAllCss(this)"
							type="checkbox" group="cancelCard" class="checkboxCtrl"></th> -->
						<th width="3%">选择</th>
						<th width="15%">市民卡号</th>
						<th width="15%">卡产品</th>
						<th width="10%">卡类型</th>
						<th width="10%">姓名</th>
						<th width="15%">证件类型</th>
						<th width="22%">证件号码</th>
						<th width="10%">卡状态</th>
					</tr>
				</thead>
				<tbody id="cancelCard">
					<tr>
						<td colspan='7' align='center'>请先读卡查询数据</td>
					</tr>
				</tbody>
			</table>
		</div>
		<!-- <div class="panelBar">
			<div class="pages">
				<span>显示</span>
					<select id="numPerPageByCancelCard" name="numPerPage" onchange="paging(this,$('#getCancelCardInfo'),getCancelCardInfo)">
						<option value="20">20</option>
						<option value="30">30</option>
						<option value="50">50</option>
						<option value="100">100</option>
					</select>
				<span id="totalCountByCancelCard" ></span>
			</div>
				<div id="paginationByCancelCard" class="pagination1"  ></div>
		</div> -->
		<div class="panelBar">
			<div class="pages">
				<span>显示</span> <select class="combox" name="numPerPage"
					onchange="navTabPageBreakCommon({numPerPage:this.value},'cancelCard',getCancelCardInfo)">
					<option value="20">20</option>
					<option value="50">50</option>
					<option value="100">100</option>
					<option value="200">200</option>
				</select> <span id="totalCountByCancelCard">条，共0条</span>
			</div>

			<div callback='getCancelCardInfo' id="paginationByCancelCard"
				rel="cancelCard" class="pagination" targetType="navTab"
				totalCount="0" numPerPage="5" pageNumShown="5" currentPage="0"></div>

		</div>
		<div class="pageFormContent">
			<div class="formBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit" onclick="return validateChechBox8();">注销登记</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</div>
</form>


